<div class="col-sm-12">
  <div class="widget-box">
    <div class="widget-header">
      <h4>过滤条件</h4>
    </div>
    <div class="widget-body">
      <div class="widget-main">
        <form class="form-inline row">
          <div class="col-sm-3">
            <input type="text" name="search" value="{$query['search']}" class="form-control" placeholder="需要搜索的关键字">
          </div>
          <div class="col-sm-2">
            <select name="status" class="form-control">
              <option value=""  {if !is_numeric($query['status']) || !in_array($query['status'], [Item::IS_ONLINE, Item::IS_OFFLINE])}selected="selected"{/if}>状态</option>
              <option value="{Item::IS_OFFLINE}" {if is_numeric($query['status']) && $query['status'] == Item::IS_OFFLINE}selected="selected"{/if}>下架</option>
              <option value="{Item::IS_ONLINE}" {if is_numeric($query['status']) && $query['status'] == Item::IS_ONLINE}selected="selected"{/if}>上架</option>
            </select>
          </div>
          <div class="col-sm-2">
           <select id="cateid" name="cate_id" class="form-control">
             {if $itemCate}<option value="{$itemCate->cate_id}">{$itemCate->name}</option>{else}<option value=""></option>{/if}
           </select>
          </div>
          <div class="col-sm-4">
            <button type="subbit" class="btn btn-purple btn-sm">
              查询
              <i class="icon-search icon-on-right bigger-110"></i>
            </button>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
<script>
$('#cateid').select2(LIVE.component.select2.config({
  placeholder: '请选择一个商品分类',
  ajax: {
    url : '{url('admin/store/cate')}',
    data: function(params) {
      return { search: params.term, page: params.page };
    },
    processResults: function (res, params) {
      params.page = params.page || 1;
      var data = res.result;
      return {
        results: data.list.map(function(cate) { return { id: cate.cate_id, text: cate.name } }),
        pagination: { more: data.next }
      };
    },
  },
  language: { 'noResults': function(){ return '<span>找不到相关的商品分类，<a href="{url('admin/store/cate')}">添加商品分类</a></span>' }},
}));



</script>